window.addEvent('load', function() {
	// get set color
	setColor = document.getElementById('color').value;
	palette = [
		  "#000000"
	    , "#575757"
	    , "#a0a0a0"
	    , "#2a4bd7"
	    , "#1d6914"
	    , "#814a19"
	    , "#8126c0"
	    , "#9dafff"
	    , "#81c57a"
	    , "#e9debb"
	    , "#ad2323"
	    , "#29d0d0"
	    , "#ffee33"
	    , "#ff9233"
	    , "#ffcdf3"
	    ]
	    
	palette = palette.combine([setColor]);
	selectedColor = palette.indexOf(setColor);
	
	// Create the color picker with some colors
	var cp = new MooColorPicker($('cp'), {
	    colors: palette
	    , defaultColor: selectedColor // Select #4A7390
	    , className: 'colorbox'
	    , selectedClassName: 'colorbox_selected'
	});
	
	// Display current color
	cp.addEvent('change', function(col, box) { 
	    $('color').set('value', cp.getCurrentColor());
	});
});

